{template 'common/header'}
<script language="JavaScript" src="{MODULE_URL}template/public/js/delete.js"></script>
<div>
    <!-- Nav tabs -->
    <ul class="nav nav-tabs" role="tablist">
        <li role="presentation" {if $op=="list"}class="active"{/if}><a href="{php echo $this->createWebUrl('news',array('op'=>'list'));}">动态列表</a></li>
        <li role="presentation" {if $op=="category" || $op=="category_add"}class="active"{/if}><a href="{php echo $this->createWebUrl('news',array('op'=>'category'));}">动态分类</a></li>
    </ul>
    {if $op == 'category'}
    <div class="clearfix">
        <form action="{php echo $this->createWebUrl('news',array('op'=>'category'));}" method="post" class="we7-form" role="form">
            <div class="form-group">
                <!--隐藏添加功能,不允许修改-->
                <!--<div class="pull-right">
                    <a href="{php echo $this->createWebUrl('news',array('op'=>'category_add'));}" class="btn btn-primary">添加分类</a>
                </div>-->
            </div>

            <table class="table we7-table table-hover">
                <col width="100px"/>
                <col/>
                <col width="100px"/>
                <tr>
                    <th>排序</th>
                    <th>分类名称</th>
                    <!--隐藏删除-->
                    <!--<th class='text-right'>操作</th>-->
                </tr>

                {loop $categorys $cate}
                <input type="hidden" name="ids[]" value="{$cate['id']}"/>
                <tr>
                    <td><input type="text" name="displayorder[]" value="{$cate['displayorder']}" class="form-control"/></td>
                    <td><input type="text" name="title[]" value="{$cate['title']}" class="form-control"/></td>
                    <!--隐藏删除-->
                    <!--<td>
                        <div class="link-group">
                            <a href="{php echo $this->createWebUrl('news',array('op'=>'category_del','id' => $cate['id']));}" class="del" onclick="delcfmi('删除分类后，该分类下动态也会被删除，确定删除吗？')">删除</a>
                        </div>
                    </td>-->
                </tr>
                {/loop}

            </table>


            <div class="form-group">
                <div class="col-sm-8 col-lg-9 col-xs-12">
                    <input type="submit" class="btn btn-primary" name="submit" value="提交"/>
                    <input type="hidden" name="token" value="{$_W['token']}"/>
                </div>
            </div>
        </form>
    </div>
    {elseif $op == 'category_add'}
    <div class="clearfix">
        <form action="{php echo $this->createWebUrl('news',array('op'=>'category_add'));}" method="post" class="form-horizontal" role="form">
            <div class="panel panel-default">
                <div class="panel-body">
                    <div id="tpl">
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-2 col-md-2 control-label">分类名称</label>
                            <div class="col-sm-8 col-lg-9 col-xs-12">
                                <input type="text" class="form-control" name="title[]" vlaue="" placeholder="分类名称"/>
                                <div class="help-block">请填写分类名称</div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-2 col-md-2 control-label">排序</label>
                            <div class="col-sm-8 col-lg-9 col-xs-12">
                                <input type="text" class="form-control" name="displayorder[]" vlaue="" placeholder="排序"/>
                                <div class="help-block">数字越大，越靠前</div>
                            </div>
                        </div>
                        <hr/>
                    </div>
                    <div id="container"></div>
                    <div class="form-group">
                        <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
                        <div class="col-sm-8 col-lg-9 col-xs-12">
                            <a href="javascript:;" id="category-add"><i class="fa fa-plus-circle"></i> 继续添加分类</a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-8 col-lg-9 col-xs-12">
                    <input type="submit" class="btn btn-primary" name="submit" value="提交"/>
                    <input type="hidden" name="token" value="{$_W['token']}"/>
                </div>
            </div>
        </form>
    </div>
    {/if}
</div>
<script>
    $(function(){
        $('#category-add').click(function(){
            var html = $('#tpl').html();
            $('#container').append(html);
            return false;
        });
    });
</script>
{template 'common/footer'}